package com.czy.owner.api;

import com.czy.owner.db.UserHelper;
import com.czy.owner.global.Constants;
import com.czy.owner.net.api.BaseApi;
import com.czy.owner.net.listener.HttpOnNextListener;
import com.czy.owner.utils.MyLog;
import com.trello.rxlifecycle.components.support.RxAppCompatActivity;

import retrofit2.Retrofit;
import rx.Observable;

/**
 * Created by wangyang on 2017/5/10 0010.
 */

public class OrderCountInfoApi extends BaseApi {
    private String session;
    private String storeId;
    private String closeMall;

    public OrderCountInfoApi(HttpOnNextListener listener, RxAppCompatActivity rxAppCompatActivity) {
        super(listener, rxAppCompatActivity);
        setShowProgress(false);
        setCache(true);
        setMothed(UserHelper.getInstance().getUserAccount()+ Constants.OWN_INFO_COUNTINFO);//相当于缓存保存的Key
        setCookieNetWorkTime(0);//有网缓存0s,在0s内点击无效
        setCookieNoNetWorkTime(24 * 60 * 60 * 30);//无网缓存30天

    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getSession() {
        return session;
    }

    public void setSession(String session) {
        this.session = session;
    }

    public String getCloseMall() {
        return closeMall;
    }

    public void setCloseMall(String closeMall) {
        this.closeMall = closeMall;
    }

    @Override
    public Observable getObservable(Retrofit retrofit) {
        HttpPostService service = retrofit.create(HttpPostService.class);
        return service.getOwnOrderCountInfoApi(getSession(),getStoreId(),getCloseMall());
    }


}
